<?php
$xtpl = new XTemplate("modules/home/page.htm");
//--
//--
//--
//--
$waypathlink = '&raquo;&nbsp;<a href="#" class="waypath">Static Page Management</a>';
$xtpl_main->assign("waypathlink",$waypathlink);
//--
$save_button = $GUI->button_ren("Save","javascript: doSaveStaticPage();");
$xtpl->assign("save_button",$save_button);
//--
//--

//--
$POST = $_POST;
//--

if($_POST[type] == 'EDIT' ){
	$POST[title]= addslashes($POST[title]);
	$POST[content]= addslashes($POST[content]);
	$DB->DBUpdate('static_pages', $POST, "WHERE sp_id='".$_POST[id]."'");
	//--
	$GUI->redir("?mod=home&catepath=".$_GET[catepath]."&act=page&page_name=".$_GET[page_name]."&cid=".$_GET['cid']."");
}

if($_POST[type] == 'NEW'){
    $POST[title]= addslashes($POST[title]);
	$POST[content]= addslashes($POST[content]);
	$POST[page]=$_GET['page_name'];
	//$POST[cate_id]=$_GET['cid'];
	$DB->DBInsert('static_pages', $POST);
	//--
	$GUI->redir("?mod=home&catepath=".$_GET[catepath]."&act=page&page_name=".$_GET[page_name]."&cid=".$_GET['cid']."");
}
//
//--

//--

$row = $DB->FetchData('static_pages','*',"WHERE page='".$_GET[page_name]."'");
	$row[title]=stripslashes($row[title]);
	if($row[page] !='' ){
		$row[type] ='EDIT';
	}else{
		$row[type] ='NEW';
	}
//--

//--
$_FCKeditor = new FCKeditor("content");
$_FCKeditor->BasePath ="../admin/".$siteFCKeditorPath;
$_FCKeditor->Width = '95%';
$_FCKeditor->Height = '600';
$_FCKeditor->Value = stripslashes($row[content]);
//--
$row[title]=stripslashes($row[title]);
$xtpl->assign("write",$row);
//--
//--
//--
//--
//--
//--


?>